package com.company.woye.checkmakesure.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.company.woye.R;
import com.company.woye.checkmakesure.bean.CutPAD_CheckClothBean;
import com.company.woye.checkmakesure.bean.LuBuDetailBean;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

public class MakeSureDeLvTopAdapter extends BaseAdapter {

    private LayoutInflater inflater;
    private Context mContext;
    private List<LuBuDetailBean.DataBean.TxmListBean> list;

    public MakeSureDeLvTopAdapter(Context context, List<LuBuDetailBean.DataBean.TxmListBean> list) {
        this.inflater = LayoutInflater.from(context);
        this.mContext = context;
        this.list = list;
    }

    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int position) {
        return list.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder viewHodler = null;
        if (convertView == null) {
            convertView = inflater.inflate(R.layout.item_check_top_detail, parent, false);
            viewHodler = new ViewHolder(convertView);
            convertView.setTag(viewHodler);
        } else {
            viewHodler = (ViewHolder) convertView.getTag();
        }
        viewHodler.tvNum.setText(list.get(position).getXh()+"");
        viewHodler.tvMldj.setText(list.get(position).getJydj()+"");
        viewHodler.tvCode.setText(list.get(position).getTxm()+"");
        viewHodler.tvGanghao.setText(list.get(position).getGh()+"");
        viewHodler.tvPiece.setText(list.get(position).getSjcs()+"");
        viewHodler.tvSb.setText(list.get(position).getSb()+"");
        return convertView;
    }


    static
    class ViewHolder {
        @BindView(R.id.tv_num)
        TextView tvNum;
        @BindView(R.id.tv_code)
        TextView tvCode;
        @BindView(R.id.tv_ganghao)
        TextView tvGanghao;
        @BindView(R.id.tv_piece)
        TextView tvPiece;
        @BindView(R.id.tv_mldj)
        TextView tvMldj;
        @BindView(R.id.tv_sb)
        TextView tvSb;
        @BindView(R.id.ll)
        LinearLayout ll;

        ViewHolder(View view) {
            ButterKnife.bind(this, view);
        }
    }
}
